package com.flx.noodle.websocket.controller;

import com.flx.noodle.websocket.entity.SSOUser;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import util.WsConstant;

import javax.servlet.http.HttpServletRequest;

/**
 * Created by fenglixiong on 2017/10/2.
 */
@Controller
@RequestMapping("/chat")
public class ChatController {

    @RequestMapping("/chat.htm")
    public String chat(@RequestParam(value = "roomId")Integer roomId, ModelMap model,
                       HttpServletRequest request){
        SSOUser ssoUser = (SSOUser)request.getSession().getAttribute(WsConstant.WEBSOCKET_SESSION_KEY);
        model.addAttribute("user",ssoUser);
        model.addAttribute("roomId",roomId);
        return "chat/chat";
    }

}
